package com.neusoft.lohas.common.utils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.neusoft.lohas.common.restTemplate.client.HandResultBean;
import com.neusoft.lohas.common.restTemplate.client.HandleStatusEnum;
import com.neusoft.lohas.common.restTemplate.client.ResponseCode;

/**
 * 返回给客户端的状态信息封装位置,不要在service层使用
 * @author Administrator
 *
 */
@JsonInclude(Include.NON_NULL)
public class StatusBean {
	public static final transient String REQUEST_ERRORE_STATUS_KEY = ResponseCode.REQUEST_ERRORE_STATUS_KEY;
	private int status;
	private String message = "success";

	public StatusBean() {
		status = ResponseCode.SUCCESS;
		message = "成功";
	}

	public StatusBean(HandResultBean<?> reult) {
		status = reult.getStatus();
		message = reult.getMessage();
	}

	public StatusBean(HandleStatusEnum status, String message) {
		this.status = status.getStatusCode();
		this.message = message;
	}

	public StatusBean(int status, String message) {
		this.status = status;
		this.message = message;
	}

	public final int getStatus() {
		return status;
	}

	public final void setStatus(int status) {
		this.status = status;
	}

	public final String getMessage() {
		return message;
	}

	public final void setMessage(String message) {
		this.message = message;
	}

	@Override
	public String toString() {
		return "StatusBean [status=" + status + ", message=" + message + "]";
	}

}
